#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'tian'
__data__ = '2021/12/15 17:47'
# software: PyCharm

from django import forms
from apps.app01 import models
from .bootstrap import BootStrapForm


class FolderModelForm(BootStrapForm, forms.ModelForm):
    class Meta:
        model = models.FileRepository
        fields = ["name"]


class ChildModelForm(BootStrapForm, forms.ModelForm):
    class Meta:
        model = models.FileRepository
        fields = ["name"]


class FileModelForm(forms.ModelForm):
    etag = forms.CharField(label="ETag")

    class Meta:
        model = models.FileRepository
        exclude = ["project", "file_type", "update_datetime"]

    def __init__(self, request, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.request = request


class DownLoad(BootStrapForm, forms.ModelForm):
    class Meta:
        model = models.UploadApk
        fields = ["apk_file", "versions", "context", "comment"]
        widgets = {
            "context": forms.Select(attrs={'class': "form-select"}),
        }
